<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<style>
/* .grid{ */
/* 	padding-left: 15px; */
/* 	padding-right: 15px; */
/* } */
/* .title { */
/* 	margin: 5px; */
/* 	color: #2494F2; */
/* 	font-size: 15px; */
/* } */

/* .description { */
/* 	margin: 5px; */
/* 	color: #7c7c7c; */
/* 	font-size: 14px; */
/* } */

/* .description { */
/* 	margin: 5px; */
/* 	color: #7c7c7c; */
/* 	font-size: 14px; */
/* } */

/* .postedBy { */
/* 	float: right; */
/* 	margin: 5px; */
/* 	color: #7c7c7c; */
/* 	font-size: 10px; */
/* 	position: relative; */
/* } */

/* .postedBy div{ */
/* 	text-align: right; */
/* 	right: 0; */
/* 	margin-right: 0; */
/* } */

/* .grid .row .span4 { */
/* 	border: 1px solid #e0dfdf; */
/* 	border-radius: 3px; */
/* 	padding: 5px; */
/* 	box-shadow: 1px 1px 2px #888888; */
/* } */

/* .read-more { */
/* 	cursor: pointer; */
/* 	color: blue; */
/* } */
</style>

<div class="panel-box">
    <div class=titlebar>
        <span class="glyphicon glyphicon-list-alt"></span> ข่าวประชาสัมพันธ์
    </div>
    <div class="panel-body">
        <ul class="ul-row-style">
        	<c:if test="${not empty NEWSALLDATAS}">
        		<c:forEach items="${NEWSALLDATAS}" varStatus="i" var="x">
		            <li>
		                <img height="100" width="100" src="data:image/png;base64,${x.strPicture}"/>
		                <c:set var="now" value="<%=new java.util.Date()%>"/>
                    	<c:set var="newDate" value="${x.createdDate.time + (60*60*164*1000) }"/>
                    	<c:set var="nowDate" value="${now.time}"/>
                    	
                    	<jsp:useBean id="newDateBean" class="java.util.Date"/>
						<c:set target="${newDateBean}" property="time" value="${newDate}"/>
						
						<jsp:useBean id="nowDateBean" class="java.util.Date"/>
						<c:set target="${nowDateBean}" property="time" value="${nowDate}"/>
						
		                <a href="${pageContext.request.contextPath}/news/${x.id}">
		                    ${x.name}
		                    <c:if test="${nowDateBean <= newDateBean}">
								 <img src="${pageContext.request.contextPath}/images/new_icon.gif"/>
							</c:if>
		                </a>
		                <span class="description">
		                    ${x.description}
		                </span>
		                <span class="postby">
		                    เขียนเมื่อวันที่ <fmt:formatDate pattern="yyyy-MM-dd" value="${x.createdDate}" /> เวลา <fmt:formatDate pattern="HH:mm:ss" value="${x.createdDate}" />
		                </span>
		            </li>
            	</c:forEach>
            </c:if>
            
        </ul>
    </div>
</div>




<!-- 			<div class="panel-content bg-white"> -->

<!-- 				<div class="grid fluid"> -->
<%-- 						<c:set var="startDivRow" value="0"/> --%>
<%-- 						<c:if test="${not empty NEWSALLDATAS}"> --%>
<%-- 							<c:forEach items="${NEWSALLDATAS}" varStatus="i" var="x"> --%>
<%-- 								<c:if test="${i.index == 0 || i.index%3==0}"> --%>
<!-- 									<div class="row"> -->
<%-- 									<c:set var="startDivRow" value="${i.index}"/> --%>
<%-- 								</c:if> --%>
<!-- 								<div class="span4"> -->
<!-- 									<div> -->
<%-- 										<img src="data:image/png;base64,${x.strPicture}" style="height: 100px" /> --%>
<!-- 									</div> -->
<!-- 									<div> -->
<%-- 										<span class="title"><strong>${x.name}</strong></span> --%>
<!-- 										<div class="description"> -->
<!-- 											<span style="white-space: nowrap; overflow: hidden; width: 98%; display: inline-block;"> -->
<%-- 												${x.description} --%>
<!-- 											</span>  -->
<!-- 											<span>  -->
<!-- 												<span style="cursor: pointer;" class="button small">อ่านต่อ »</span> -->
<!-- 											</span> -->
<!-- 										</div> -->
<!-- 										<div class="postedBy"> -->
<%-- 											<div>เขียนโดย ${x.createdAccount.titleName}${x.createdAccount.fullname};<fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${x.createdDate}" /></div> --%>
<%-- 											<div>แก้ไขโดย ${x.updatedAccount.titleName}${x.updatedAccount.fullname};<fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${x.updatedDate}" /></div> --%>
<!-- 										</div> -->
<!-- 										</div> -->
<!-- 								</div> -->
<%-- 								<c:if test="${i.index == startDivRow+2}"> --%>
<!-- 									</div> -->
<%-- 								</c:if> --%>
<%-- 							</c:forEach> --%>
<%-- 						</c:if> --%>
					

<!-- 					<div class="row"> -->
<!-- 						<div class="pagination" style="margin: 0 auto 0 auto; width: 280px"> -->
<!-- 							<ul> -->
<!-- 								<li class="first"><a><i class="icon-first-2"></i></a></li> -->
<!-- 								<li class="prev"><a><i class="icon-previous"></i></a></li> -->
<!-- 								<li class="active"><a>1</a></li> -->
<!-- 								<li><a>2</a></li> -->
<!-- 								<li><a>3</a></li> -->
<!-- 								<li class="next"><a><i class="icon-next"></i></a></li> -->
<!-- 								<li class="last"><a><i class="icon-last-2"></i></a></li> -->
<!-- 							</ul> -->
<!-- 						</div> -->
<!-- 					</div> -->
<!-- 				</div> -->

<!-- 			</div> -->
<!-- 		</div> -->
<!-- 	</div> -->
<!-- </div> -->